package net.kelissa.jenetic.impl.gene;

import net.kelissa.jenetic.Gene;
import net.kelissa.jenetic.RandomUtil;

public class GeneInt extends GeneValueBase<Integer>
{

  private int randMin = -10;

  private int randMax = 10;

  public GeneInt(Integer value)
  {
    super(value);
  }

  @Override
  public void mutate()
  {
    int rand = RandomUtil.getRandom(this.randMin, this.randMax);
    this.value += rand;
  }

  @Override
  public Gene clone()
  {
    return new GeneInt(this.value);
  }

  @Override
  public int compareTo(Gene other)
  {
    Integer otherValue = ((GeneInt)other).getValue();
    return this.value.compareTo(otherValue);
  }

  public double getRandMin()
  {
    return randMin;
  }

  public void setRandMin(int randMin)
  {
    this.randMin = randMin;
  }

  public int getRandMax()
  {
    return randMax;
  }

  public void setRandMax(int randMax)
  {
    this.randMax = randMax;
  }

}
